﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<UI.Data.Ventas>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    List
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Lista de publicaciones</h2>
    <% using (Html.BeginForm())
       { %>
    <table align="center">
        <tr>
            <td>
                <%:Html.Label("Deporte:")%>
            </td>
            <td>
                <%:Html.DropDownList("Deporte", new SelectList((IEnumerable)ViewData["Deportes"], "Id", "Nombre"))%>
            </td>
        </tr>
        <tr>
            <td>
                <%:Html.Label("Precio:")%>
            </td>
            <td>
                <input type="number" name="txtPrecio" />
            </td>
        </tr>
        <tr>
            <td>
                <%:Html.Label("Nombre:")%>
            </td>
            <td>
                <input type="text" name="txtNombre" />
            </td>
        </tr>
        <tr>
            <td>
                <%:Html.Label("Valoracion:")%>
            </td>
            <td>
                <input type="number" name="txtValoracion" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input style="float: right" type="submit" value="Buscar" class="btn btn-primary" />
            </td>
        </tr>
    </table>
    <%} %>
    <br />
    <%if (!IsPostBack && Model.Count() > 0)
      { %>
        <table align="center" class="table table-hover table-stripped" style="overflow:auto">
            <tr>
                <th>
                    <%: Html.DisplayName("Imagen")%>
                </th>
                <th>
                    <%: Html.DisplayName("Producto")%>
                </th>
                <th>
                    <%: Html.DisplayName("Precio")%>
                </th>
                <th>
                    <%: Html.DisplayName("Usuario")%>
                </th>
                <th>
                    <%: Html.DisplayName("Valoracion")%>
                </th>
                <th>
                </th>
            </tr>
            <% if (Model.Count() > 0)
               { %>
            <% foreach (var item in Model)
               { %>
            <tr>
                <td>
                    
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.Producto.Nombre)%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.Producto.Precio)%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.Usuarios.Username)%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.Usuarios.Puntos)%>
                </td>
                <td>
                    <%: Html.ActionLink("Ver", "Index", new { id = item.Id })%>
                </td>
            </tr>
            <% } %>  
            <%} %>    
            <% else
               { %>
                  <%:Html.DisplayName("No se encuentran publicaciones con el filtro establecido")%> 
               <%} %>      
        </table>
    <%} %>
    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsSection" runat="server">
</asp:Content>
